home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 7 / Amiga Format AFCD07 (Dec 1996, Issue 91).iso / serious / shareware / 3d / raystorm-complete / examples / exa.lha / arexx / bounce.ray < prev    next >
Text File  |  1996-07-27  |  2KB  |  82 lines

  1. /***************
  2.  * NAME:        bounce.ray
  3.  * DESCRIPTION: Tutorial: bouncing ball
  4.  ***************/
  5.  
  6. signal on error
  7.  
  8. options results
  9.  
  10. IF ~show('P','RAYSTORM') THEN DO
  11.   address COMMAND 'run >NIL: <NIL: /RayStorm'
  12.   address COMMAND WaitForPort RAYSTORM
  13. END
  14.  
  15. address RAYSTORM
  16.  
  17. g = .2
  18. frames = 17
  19.  
  20. 'BRUSHPATH /brushes'
  21. 'TEXTUREPATH /textures'
  22. 'SETSCREEN 160 128'
  23. 'SETCAMERA <0,10,40> <0,5,0> <0,1,0> 25 20'
  24. 'SETWORLD [10,30,200] [10,10,10] RANDJIT'
  25. 'POINTLIGHT <-5,10,50>'
  26.  
  27. 'NEWACTOR groundactor'
  28. 'ALIGNMENT 0 ' frames+2 ' <0,0,360>'
  29.  
  30. 'NEWSURFACE groundtop'
  31. 'DIFFUSE [255,255,255]'
  32. 'SPECULAR [0,0,0]'
  33. 'REFLECT [50,50,50]'
  34. 'IMTEXTURE checker.itx <0,-1,0> <0,0,0> <10,10,10> ACTOR groundactor'
  35.  
  36. 'NEWSURFACE groundbottom'
  37. 'DIFFUSE [255,0,0]'
  38. 'SPECULAR [0,0,0]'
  39. 'REFLECT [50,50,50]'
  40. 'IMTEXTURE checker.itx <0,-1,0> <0,0,0> <1.5,1.5,1.5> ACTOR groundactor'
  41.  
  42. 'TRIANGLE groundtop <2,0,-2> <2,0,-2> <2,0,2> ACTOR groundactor'
  43. 'TRIANGLE groundtop <2,0,-2> <-2,0,2> <2,0,2> ACTOR groundactor'
  44. 'TRIANGLE groundbottom <2,-.01,-2> <2,-.01,-2> <2,-.01,2> ACTOR groundactor'
  45. 'TRIANGLE groundbottom <2,-.01,-2> <-2,-.01,2> <2,-.01,2> ACTOR groundactor'
  46.  
  47. speed = -g
  48. pos = 10
  49. 'NEWACTOR ballactor <0,'pos',0>'
  50. do i=0 to frames
  51.   'POSITION ' -i i+1 '<0,'pos',0>'
  52.   pos = pos+speed
  53.   if pos<=1 & speed<0 then
  54.     speed = -speed
  55.   else
  56.     speed = speed-g
  57. end
  58. 'ALIGNMENT 0 ' frames+2 ' <0,360,0>'
  59.  
  60. 'NEWSURFACE ball'
  61. 'BRUSH earth.png COLOR WRAPXY <0,10,0> <0,0,0> <.1,.1,.1> ACTOR ballactor'
  62.  
  63. 'SPHERE ball <0,10,0> 1 ACTOR ballactor'
  64.  
  65. 'ANTIALIAS 1'
  66. 'DISTRIB 2'
  67.  
  68. do i=0 to frames
  69.   'STARTRENDER QUICK FROM 'i' TO 'i+1
  70.   'SAVEPIC bounce' || RIGHT(i,4,0) || '.iff'
  71. end
  72.  
  73. 'CLEANUP'
  74.  
  75. exit 0
  76.  
  77. error:
  78. say "Error" rc "in line" sigl ":"
  79. GETERRORSTR rc
  80. say result
  81. exit 0
  82.